﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;

// Version 1.1
// 实现Show / Hide页面接口

public class PageEvent : MonoBehaviour
{
	public ShowEvent OnShow;
	[Serializable]
	public class ShowEvent : UnityEvent<string> { }

	public HideEvent OnHide;
	[Serializable]
	public class HideEvent : UnityEvent<string> { }

	public void Show(string pg_key)
	{
		if (OnShow.GetPersistentEventCount() > 0)
			OnShow.Invoke(pg_key);
		else
			gameObject.SetActive(true);
	}

	public void Hide(string pg_key)
	{
		if (OnHide.GetPersistentEventCount() > 0)
			OnHide.Invoke(pg_key);
		else
			gameObject.SetActive(false);
	}
}
